<?php
//
defined('BY_JYA') or exit('error');
$_RQ['op']=$_RQ['op']?$_RQ['op']:'main';
$_SESSION['uid']=$_SESSION['uid']?:0;
if($_RQ['op']=='main'){
	$waybill=$_RQ['waybill'];
	if(!$waybill){
		exi('请选择快递单号！','error');
	}
	$express=pdo_get('jy_kuaidisys_express',array('uniacid'=>$_SESSION['uniacid'],'waybill'=>$waybill));
	if($express['uptime']<=time()-3600){
		$content=array(
			'waybill'=>$waybill,
		);
		$res=$this->model('api')->getguiji($content);
		$data=array(
			'data'=>ijson_encode($res),
			'uptime'=>TIMESTAMP,
		);
		if($express['id']){
			$this->update('express',$data,array('id'=>$express['id']));
		}else{
			$data['uniacid']=$_SESSION['uniacid'];
			$data['waybill']=$waybill;
			$data['createtime']=TIMESTAMP;
			$this->insert('express',$data);
		}
		$express=array_merge($express,$data);
	}
	$express['data']=json_decode($express['data'],true);
	$return['express']=$express;
	set_html('title','物流详情');
	exi($return);
}
?>